package com.wengluobiancheng.demo04;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo01 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10086);
        Socket accept = ss.accept();
        InputStream inputStream = accept.getInputStream();
        int b;
        while ((b = inputStream.read()) != -1) {
            System.out.println((char) b);
        }
        System.out.println(".....");

        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));
        bw.write("咋地");
        bw.flush();
        bw.newLine();

        bw.close();
        ss.close();
        inputStream.close();
        accept.close();
    }
}
